package oocis.util;

import java.net.*;

public class GetIP {
	
	private static InetAddress localIP;
	
	public GetIP(){
		
	}

	public static void main(String [] args){
		GetIP t = new GetIP();
		System.out.println(t.getIP());
	}
	
	public static String getIP(){
		try {
			localIP = InetAddress.getLocalHost();
//			System.out.println(localIP);
			String _ip = "";
			String _src_ip = localIP.toString();
			int i = _src_ip.length() - 1;
			while (i >= 0 && _src_ip.charAt(i) != '/'){
				_ip = _src_ip.charAt(i) + _ip;
				i--;
			}
			return _ip;
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			return "ERROR";
		}
		
	}
}
